<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // sum总和，average平均
        var Array1 = [1, 2, 3, 4, 5, 6, 7, 8];
        var sum = 0;
        for (var i = 0; i < Array1.length; i++) {
            sum += Array1[i];
        }
        var average = sum / Array1.length;
        console.log(sum);
        console.log(average);
    </script>
</head>

<body>

</body>

</html>